Now that we have seen what the command command does, we can improve
the functionality of our original example script, DOS-DOpus.dopus5.
/*
$VER: DOS-DOpus.dopus5 1.1 (28.7.98)
Loads current shell directory into a new DOpus5 lister, selects files
according to the passed filespec.
*/
options results /* Enable results */
parse arg pattern . /* Parse a given pattern into a variable */
if ~show('P','DOPUS.1') then do /* Check for DOPUS.1 ARexx port */
Say "Directory Opus is not running." /* Warn user if Opus not running */
Exit 5 /* Exit with result code = 5 (Warn) */
end /* End this loop */
Address 'DOPUS.1' /* Address Opus */
dopus front /* Bring Opus to the front */
dir = pragma('d') /* Returns current shell in 'dir' */
lister new dir /* Open a new lister, path 'dir' */
handle = result /* Store the handle */
lister wait handle /* Wait for the lister to finish */
if pattern ~= '' then
command source handle select name='"'pattern'"' /* Select the files */
lister refresh handle /* Refresh the display */
exit /* Exit */
Now when you enter:
rx DOpus5:ARexx/DOS-DOpus.dopus5 #?.info
a lister will open with your shell's current path, and any icon files will
show as selected.
It's also possible to have Opus perform some function on the selected files
by adding a couple of lines.
if function ~= '' then
command source handle original wait function
If you add these two lines after the command source handle select... line,
then when you enter:
rx DOpus5:ARexx/DOS-DOpus.dopus5 #?.info delete
A lister will open, all icon files will be selected then they will be
deleted.
|